#ifndef __syntax_call_H__
#define __syntax_call_H__

#include "syntax_base.h"
#include "syntax_attribute.h"

#include <string>
using namespace std;

namespace syntax_analysis
{
	
	class syntax_call : public syntax
	{
	// construct
	public:
		syntax_call() : syntax()
		{
			m_name = "";
			m_attr = NULL;
		}

		syntax_call( string name, syntax_attribute *attr ) : syntax()
		{
			m_name = name;
			m_attr = attr;
		}

		virtual ~syntax_call()
		{
			if( m_attr != NULL )
				delete m_attr;
			m_name = "";
			m_attr = NULL;
		}

	// inherit
	public:
		virtual syntax_type get_type();
		virtual string to_string();
		
		virtual bool parse( parse_info *info );
		virtual bool reparse( parse_info *info );
		virtual bool can_accept_more( parse_para *para );
		virtual bool should_accept_more( parse_para *para );

	// common
	public:
		string get_name()
		{
			return m_name;
		}

		void set_name( string name )
		{
			m_name = name;
		}

		syntax_attribute* get_attr()
		{
			return m_attr;
		}

		void set_attr( syntax_attribute *attr )
		{
			if( m_attr != NULL )
				delete m_attr;
			m_attr = attr;
		}

	protected:
		virtual bool do_parse( parse_para *para, parse_info *child_info );

	private:
		string m_name;
		syntax_attribute *m_attr; 
	};

}

#endif // __syntax_call_h__
